<template>
  <div class="detail">
    <div class="menu">
      <div class="top">
        <el-icon><HomeFilled /></el-icon>
        <span>/ 医院信息</span>
      </div>
      <el-menu :default-active="$route.path" class="el-menu-vertical-demo">
        <el-menu-item
          index="/hospital/registration"
          @click="changeRoute('/hospital/registration')"
        >
          <el-icon><icon-menu /></el-icon>
          <span>预约挂号</span>
        </el-menu-item>
        <el-menu-item
          index="/hospital/detial"
          @click="changeRoute('/hospital/detial')"
        >
          <el-icon><document /></el-icon>
          <span>医院详情</span>
        </el-menu-item>
        <el-menu-item
          index="/hospital/notice"
          @click="changeRoute('/hospital/notice')"
        >
          <el-icon><setting /></el-icon>
          <span>预约通知</span>
        </el-menu-item>
        <el-menu-item
          index="/hospital/Suspension"
          @click="changeRoute('/hospital/Suspension')"
        >
          <el-icon><InfoFilled /></el-icon>
          <span>停诊信息</span>
        </el-menu-item>
        <el-menu-item
          index="/hospital/Select"
          @click="changeRoute('/hospital/Select')"
        >
          <el-icon><Search /></el-icon>
          <span>查询/取消</span>
        </el-menu-item>
      </el-menu>
    </div>
    <div class="contend">
      <router-view></router-view>
    </div>
  </div>
</template>

<script setup lang="ts">
//引入图标组件
import {
  Document,
  Menu as IconMenu,
  InfoFilled,
  Setting,
  Search,
  HomeFilled,
} from "@element-plus/icons-vue";
//引入仓库
import useDetailStore from "@/store/modules/hospital";
//引入路由器
import { useRouter, useRoute } from "vue-router";
//引入组合式api
import { onMounted } from "vue";
//创建路由器对象
let $router = useRouter();
let $route = useRoute();
//获取仓库
let detailStore = useDetailStore();
//挂载时获取医院详细
onMounted(() => {
  //获取医院详细
  detailStore.getHospitalDetail($route.query.hoscode);
  //获取医院科室
  detailStore.getDepartment(($route.query.hoscode) as string);
});
//路由跳转的回调
const changeRoute = (path: string) => {
  $router.push({
    path,
    query:{
      hoscode:$route.query.hoscode
    }
  });
};
</script>

<style scoped lang="scss">
.detail {
  color: #7f7f7f;
  display: flex;
  .menu {
    flex: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    .top {
      display: flex;
      margin-bottom: 10px;
      span {
        margin-left: 5px;
      }
    }
  }
  .contend {
    flex: 8;
  }
}
</style>
